<style lang="scss">
  @import 'index';
</style>
<template>
  <div class="ga-container" style="background: #fff;">
    <div class="ga-sign">
      <div class="item1 txt-center">
        <image class="head" mode="aspectFill" src="/static/images/test/img3.jpg"></image>
      </div>
      <div class="item2">
        <p class="p1">登陆后开发者将获取一些权限</p>
        <p class="p2"> <span>&#8226;</span> 获取你的公开信息(昵称、头像等)</p>

        <button type="primary" class="weui-btn" v-if="canIUse" open-type="getUserInfo" @getuserinfo="getUserInfo">微信登陆</button>
      </div>
    </div>
  </div>
      <!--<button type="primary" v-if="canIUse" open-type="getUserInfo" @getuserinfo="getUserInfo">微信登录</button>-->
</template>
<script>
import {login} from '@/utils/handleLogin'
export default {
  data () {
    return {
       canIUse:wx.canIUse('button.open-type.getUserInfo')
    }
  },
  methods: {
    getUserInfo (e) {
        if (e.target.userInfo) {
            // 点击Button弹窗授权，如果授权了，执行login
            // 因为Login流程中有wx.getUserInfo，此时就可以获取到了
            login(() => {
                // 登录成功后，返回
                wx.navigateBack()
            })
        }
    }
  },

  created () {

  },
  mounted () {

  }
}
</script>

